import { http } from "@/utils/http";
/***
 * 每个商品的详情
 */
export type goodItem = {
  /**
   * 商品id
   */
  id: "syring";
  /**
   *商品名称
   */
  name: "syring";
  /**
   *商品描述
   */
  desc: "string";
  /**
   * 商品价格
   */
  price: "string";
  picture: "string";
  discount: "null";
  orederNum: 0;
};
export type goodItemList = goodItem[];

/***
 * 二级商品
 */
export type goodChildren = {
  /**
   * 二级分类id
   */
  id: "string";
  /**
   * 二级分类名称
   */
  name: "string";
  /**
   * 二级分类图片
   */
  picture: "string";
  parentId: null;
  parentName: null;
  goods: goodItemList;
  categories: null;
  brands: null;
  saleProperties: null;
};
export type goodChildrenList = goodChildren[];

/**
 * 一级商品
 */
export type goods = {
  /**
   * 一级分类id
   */
  id: "string";
  /**
   *一级分类名称
   */
  name: "string";
  /**
   *一级分类图片
   */
  picture: "string";
  /**
   * 一级分类图片集
   */
  imageBanners: String[];
  /**
   * 二级分类集合
   */
  children: goodChildrenList;
};
export type goodsList = goods[];
/**
 *请求数据类型
 */

export type getGoodsList = {
  code: "string";
  msg: "string";
  /**
   * 一级分类集合
   */
  result: goodsList;
};
//请求商品类型
export function getCategoryTop(distributionSite = 2) {
  return http<goodsList>({
    method: "GET",
    url: "/category/top",
    data: {
      distributionSite,
    },
  });
}
